import java.util.Scanner;

public class P1425 {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        int b = sc.nextInt();
        int c = sc.nextInt();
        int d = sc.nextInt();
        int time1 = a * 60 + b;
        int time2 = c * 60 +d;
        int dt = time2 - time1;
        int e = dt / 60;
        int f = dt % 60;
        System.out.println(e + " " + f);
    }
}